local skel = fk.CreateSkill {
  name = "rmt__dajudao",
}

Fk:loadTranslationTable{
  ["rmt__dajudao"] = "大剧道",
  [":rmt__dajudao"] = "〖大叫唤〗判定生效前，你可以打出一张黑色牌替换判定牌！",

  ["#rmt__dajudao-ask"] = "大剧道：你可以打出一张黑色牌替换 %dest 的〖大叫唤〗判定！",

  ["$rmt__dajudao1"] = "（鬼叫）",
  ["$rmt__dajudao2"] = "（鬼叫）",
}

skel:addEffect(fk.AskForRetrial, {
  guicai = "control",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name) and not player:isNude() and data.reason == "rmt__dajiaohuan"
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local ids = table.filter(player:getCardIds("he"), function (id)
      return not player:prohibitResponse(Fk:getCardById(id)) and Fk:getCardById(id).color == Card.Black
    end)
    local cards = room:askToCards(player, {
      min_num = 1,
      max_num = 1,
      include_equip = true,
      skill_name = skel.name,
      pattern = tostring(Exppattern{ id = ids}),
      prompt = "#rmt__dajudao-ask::"..target.id,
      cancelable = true,
    })
    if #cards > 0 then
      event:setCostData(self, {cards = cards})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    player.room:changeJudge{
      card = Fk:getCardById(event:getCostData(self).cards[1]),
      player = player,
      data = data,
      skillName = skel.name,
      response = true,
      exchange = true,
    }
  end,
})

return skel
